package cn.template.models.common;

import lombok.Data;
import org.springframework.data.domain.Page;

@Data
public class PagingInfo <T>{
    long total;
    int totalPages;
    int page;
    int size;
    boolean isFirst;
    boolean isLast;

    public PagingInfo(Page<T> paging) {
        this.total = paging.getTotalElements();
        this.totalPages = paging.getTotalPages();
        this.page = paging.getNumber();
        this.size = paging.getSize();
        this.isFirst = paging.isFirst();
        this.isLast = paging.isLast();
    }
}
